﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class TestLoad : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        AssetBundle assetBundle = AssetBundle.LoadFromFile( Application.streamingAssetsPath + "/ui.unity3d"  );
        if (assetBundle!= null) {
            Debug.Log("加载成功!");
            GameObject objectPrefab = assetBundle.LoadAsset<GameObject>("TestPanel");

            Sprite[] sprites = assetBundle.LoadAssetWithSubAssets<Sprite>("logo_web");

            //for (int i = 0; i < sprites.Length; i++)
            //{
            //    Debug.Log(sprites[i]);
            //}

            Object[] objects = assetBundle.LoadAllAssets();

            for (int i = 0; i < objects.Length; i++)
            {
                Debug.Log(objects[i]);
            }

            GameObject.Instantiate(objectPrefab, transform);

        }

    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
